# Contributor: Leo <thinkabit.ukim@gmail.com>
# Contributor: Will Sinatra <wpsinatra@gmail.com>
# Maintainer: Erwan Rouchet <lucidiot@brainshit.fr>
pkgname=zola
pkgver=0.15.3
pkgrel=0
pkgdesc="Opionated static site generator"
url="https://github.com/getzola/zola"
arch="all !s390x !riscv64" # limited by rust/cargo
arch="$arch !ppc64le" # fail to build 'ring v0.16.20'
license="MIT"
makedepends="cargo openssl1.1-compat-dev libsass-dev oniguruma-dev"
subpackages="
	$pkgname-zsh-completion
	$pkgname-fish-completion
	$pkgname-bash-completion
	"
source="$pkgname-$pkgver.tar.gz::https://github.com/getzola/zola/archive/v$pkgver.tar.gz
	minimize-size.patch"

export RUSTONIG_SYSTEM_LIBONIG=1 # Link against system liboniguruma

prepare() {
	default_prepare
	cargo fetch --locked
}

build() {
	cargo build --frozen --release
}

check() {
	cargo test all --frozen
}

package() {
	install -Dm0755 target/release/zola "$pkgdir"/usr/bin/zola

	install -Dm644 "$builddir"/completions/zola.bash \
			"$pkgdir"/usr/share/bash-completion/completions/zola
	install -Dm644 "$builddir"/completions/_zola \
			"$pkgdir"/usr/share/zsh/site-functions/_zola
	install -Dm644 "$builddir"/completions/zola.fish \
			"$pkgdir"/usr/share/fish/completions/zola.fish
}

sha512sums="
999851de1afdc578f6a3a3bd67180b0da90eb025317d2515169982103e30f0c73315b807abbea140eb547c3c82dfcf98b34596b85e9184ac63ea28121039d07e  zola-0.15.3.tar.gz
4525e6d041fffc7550a045017d90ffeda138fd571d61822bb87dd177359bbed5520e02db68fc61a89a33b80bbdaa9439a3f059f6d22d46126e4f2e87c4248cf8  minimize-size.patch
"
